<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 *  file: controller/landing.php
 */

class Landing extends CI_Controller{

	public function index()
	{	
		 //landing page
        $d=array();
        $this->load->library('acl_auth');
        $this->acl_auth->restrict_access('logged_in');
        
        $passExpired = $this->acl_auth->isPasswordExpired();
        if (!$this->session->userdata('logged') || $passExpired ){
             // User Not yet login. Need to change password.
             // User Not yet login. Need to change password.
            if ($passExpired){
                $this->session->set_flashdata('message', $this->acl_auth->get_message("password_expired"));
            }             
            
            if ($this->acl_auth->has_role('admin')){
                redirect("admin/changePassword");
            }else{
                redirect("user/changePassword");
            }
         }

        if ($this->acl_auth->has_role('admin')){
            redirect('admin/lists'); // Admin must go to admin page.
        }

		 $views['_content'] = "landing_page";
		 //$views['_tags'] = "tags";
		 $this->template->load('template_landing', $views, $d);
	}
}
